package com.golxen.framework.executor;

import java.util.concurrent.ScheduledFuture;

/**
 *需要在任务内部取消任务的, 集成本类
 */
public abstract class CancellableTask implements Runnable {
	volatile ScheduledFuture<?> sf = null;

	public boolean cancel(boolean mayInterruptIfRunning) {
		if (sf != null) {
			return sf.cancel(mayInterruptIfRunning);
		}
		return true;
	}
}
